From 51e20c55808cfe3e51b45f6ff2a45775170fa5e4 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Wed, 18 Sep 2013 13:15:14 +0200 Subject: [PATCH] libxl: don't remove device frontend path from driver domains MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A domain different than LIBXL_TOOLSTACK_DOMID should not try to remove the frontend paths of a device. Signed-off-by: Roger Pau Monné Cc: Ian Campbell Acked-by: Ian Jackson --- tools/libxl/libxl_device.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index cce9e327dc..d5f23cfb40 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -551,6 +551,10 @@ int libxl__device_destroy(libxl__gc *gc, libxl__device *dev) const char *tapdisk_params; xs_transaction_t t = 0; int rc; + uint32_t domid; + + rc = libxl__get_domid(gc, &domid); + if (rc) goto out; for (;;) { rc = libxl__xs_transaction_start(gc, &t); @@ -560,8 +564,20 @@ int libxl__device_destroy(libxl__gc *gc, libxl__device *dev) rc = libxl__xs_read_checked(gc, t, tapdisk_path, &tapdisk_params); if (rc) goto out; - libxl__xs_path_cleanup(gc, t, fe_path); - libxl__xs_path_cleanup(gc, t, be_path); + if (domid == LIBXL_TOOLSTACK_DOMID) { + /* + * The toolstack domain is in charge for removing both the + * frontend and the backend path + */ + libxl__xs_path_cleanup(gc, t, fe_path); + libxl__xs_path_cleanup(gc, t, be_path); + } else if (dev->backend_domid == domid) { + /* + * The driver domain is in charge for removing what it can + * from the backend path + */ + libxl__xs_path_cleanup(gc, t, be_path); + } rc = libxl__xs_transaction_commit(gc, &t); if (!rc) break; -- 2.30.2